
import React from 'react'
import { connect } from 'dva'
import { Form, Button, Modal, Popconfirm, Table, message, Row, Col, Input, Switch, Select, Cascader, DatePicker, Radio } from 'antd'
import { Link, hashHistory } from 'dva/router'
import config from 'config/config'
import { mapStateToProps } from 'utils/view_utils'
import styles from './indexSettingListStyle.less'
import ListPage from 'widget/PageTmpl/ListPage'
import classnames from 'classnames/bind';
let cx = classnames.bind(styles);
import { CustomCard } from '../../../widget/Grid/CustomCard'
import FlagBtn from 'widget/FlagBtn/FlagView'
import Keypress from 'widget/Keypress'
import moment from 'moment/moment'

const FormItem = Form.Item
const Option = Select.Option;
const RangePicker = DatePicker.RangePicker

const indexSettingListView = function ({ dispatch, model, form }) {
    const formItemLayout = {
        labelCol: { span: 6 },
        wrapperCol: { span: 12 },
    };
    const formItemLayout1 = {
        labelCol: { span: 2 },
        wrapperCol: { span: 22 },
    };
    const queryItemLayout = {
        labelCol: { span: 8 },
        wrapperCol: { span: 16 },
    };
    const queryItemLayout1 = {
        labelCol: { span:  2},
        wrapperCol: { span: 4 },
    };
    const { resetFields, getFieldDecorator, validateFields, setFieldsValue } = form
    const { modelObj, namespace } = model
    //console.log("model",modelObj)
    let { buildingObj, activityData, informationData, buildTableData, type, buildData, queryData, isLive, options, quer, quers, searchlist} = modelObj

    //推荐楼盘分页
    const paginationModalBuild = {
        current: Number(buildData.paginationModalData.pageNo),
        pageNo: Number(buildData.paginationModalData.pageNo),
        pageSize: Number(buildData.paginationModalData.pageSize),
        total: Number(buildData.paginationModalData.total),
        showTotal: e => '共 ' + buildData.paginationModalData.total + ' 条',
        onChange: changePageModalBuild, //分页事件
        onShowSizeChange: changePageModalBuild, //每页条数
        showSizeChanger: true,
        showQuickJumper: true,
    }
    function changePageModalBuild(page, pageSize) {
        dispatch({
            type: `${namespace}/estateList`,
            payload: { pageNo: page, pageSize: pageSize }
        });
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { pageNo: page, pageSize: pageSize }
        });
    }
    const paginationBuild = {
        current: Number(buildData.paginationData.pageNo),
        pageNo: Number(buildData.paginationData.pageNo),
        pageSize: Number(buildData.paginationData.pageSize),
        total: Number(buildData.paginationData.total),
        showTotal: e => '共 ' + buildData.paginationData.total + ' 条',
        onChange: changePageBuild, //分页事件
        onShowSizeChange: changePageBuild, //每页条数
        showSizeChanger: true,
        showQuickJumper: true,
    }

    function changePageBuild(page, pageSize) {
        dispatch({
            type: `${namespace}/queryList`,
            payload: { pageNo: page, pageSize: pageSize }
        });
    }

    //推荐活动分页
    const paginationModalActivity = {
        current: Number(activityData.paginationModalData.pageNo),
        pageNo: Number(activityData.paginationModalData.pageNo),
        pageSize: Number(activityData.paginationModalData.pageSize),
        total: Number(activityData.paginationModalData.total),
        showTotal: e => '共 ' + activityData.paginationModalData.total + ' 条',
        onChange: changePageModalActivity, //分页事件
        onShowSizeChange: changePageModalActivity, //每页条数
        showSizeChanger: true,
        showQuickJumper: true,
    }
    function changePageModalActivity(page, pageSize) {
        dispatch({
            type: `${namespace}/activityList`,
            payload: { pageNo: page, pageSize: pageSize }
        });

        dispatch({
            type: `${namespace}/updateStore`,
            payload: { pageNo: page, pageSize: pageSize }
        });

    }
    const paginationActivity = {
        current: Number(activityData.paginationData.pageNo),
        pageNo: Number(activityData.paginationData.pageNo),
        pageSize: Number(activityData.paginationData.pageSize),
        total: Number(activityData.paginationData.total),
        showTotal: e => '共 ' + activityData.paginationData.total + ' 条',
        onChange: changePageActivity, //分页事件
        onShowSizeChange: changePageActivity, //每页条数
        showSizeChanger: true,
        showQuickJumper: true,
    }
    function changePageActivity(page, pageSize) {
        dispatch({
            type: `${namespace}/updateStore`,
            payload: {
                activityData: {
                    ...activityData,
                    paginationData: {
                        ...activityData.paginationData,
                        pageNo: page, pageSize: pageSize
                    }
                }
            }
        });
        dispatch({
            type: `${namespace}/queryActivityList`,
            payload: { pageNo: page, pageSize: pageSize }
        });
    }


    //推荐资讯分页
    const paginationModalInformation = {
        current: Number(informationData.paginationModalData.pageNo),
        pageNo: Number(informationData.paginationModalData.pageNo),
        pageSize: Number(informationData.paginationModalData.pageSize),
        total: Number(informationData.paginationModalData.total),
        showTotal: e => '共 ' + informationData.paginationModalData.total + ' 条',
        onChange: changePageModalInformation, //分页事件
        onShowSizeChange: changePageModalInformation, //每页条数
        showSizeChanger: true,
        showQuickJumper: true,
    }
    function changePageModalInformation(page, pageSize) {
        dispatch({
            type: `${namespace}/newsList`,
            payload: { pageNo: page, pageSize: pageSize }
        });
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { pageNo: page, pageSize: pageSize }
        });
    }
    const paginationInformation = {
        current: Number(informationData.paginationData.pageNo),
        pageNo: Number(informationData.paginationData.pageNo),
        pageSize: Number(informationData.paginationData.pageSize),
        total: Number(informationData.paginationData.total),
        showTotal: e => '共 ' + informationData.paginationData.total + ' 条',
        onChange: changePageInformation, //分页事件
        onShowSizeChange: changePageInformation, //每页条数
        showSizeChanger: true,
        showQuickJumper: true,
    }
    function changePageInformation(page, pageSize) {
        dispatch({
            type: `${namespace}/updateStore`,
            payload: {
                informationData: {
                    ...informationData,
                    paginationData: {
                        ...informationData.paginationData,
                        pageNo: page, pageSize: pageSize
                    }
                }
            }
        });
        dispatch({
            type: `${namespace}/queryNewsList`,
            payload: { pageNo: page, pageSize: pageSize }
        });
    }
    //修改弹窗状态
    const updateModal = ({ name = '', flag = '' }) => {
        if (name == 'build') {
            quer.resourceType = 1
            dispatch({
                type: `${namespace}/updateStore`,
                payload: {quer}
            })
            buildData.modal_visible = flag
            changeState({ buildData, type: name })
        }
        else if (name == 'activity') {
            quer.resourceType = 2
            activityData.modal_visible = flag;
            dispatch({
                type: `${namespace}/updateStore`,
                payload: {quer}
            })
            changeState({ activityData, type: name })
        }
        else if (name == 'information') {
            quer.resourceType = 3
            informationData.modal_visible = flag;
            dispatch({
                type: `${namespace}/updateStore`,
                payload: {quer}
            })
            changeState({ informationData, type: name })
        }
    };
    //弹窗确定
    function onhao() {
        if(quer.resourceType == 1 && (!quer.address || !quer.time1 || !quer.productTag || !quer.recommendName)) {
          return  message.error('请填写完整的表单内容') 
        } else if(quer.resourceType != 1 && (!quer.address || !quer.time1 || !quer.recommendName)) {
            return  message.error('请填写完整的表单内容') 
        }
        if(quer.status){
            if(quer.resourceType == 1) {
                dispatch({
                    type: `${namespace}/create`,
                    payload: {}
                })
            }else if(quer.resourceType == 2) {
                dispatch({
                    type: `${namespace}/createone`,
                    payload: {}
                })
            }else if(quer.resourceType == 3) {
                dispatch({
                    type: `${namespace}/createtow`,
                    payload: {}
                })
            }
        }else{
            if(quer.resourceType == 1) {
                dispatch({
                    type: `${namespace}/uploup`,
                    payload: {}
                })
            }else if(quer.resourceType == 2) {
                dispatch({
                    type: `${namespace}/uphuod`,
                    payload: {}
                })
            }else if(quer.resourceType == 3) {
                dispatch({
                    type: `${namespace}/upzhixun`,
                    payload: {}
                })
            }
        }
    }
    function changeSwitch(value) {
        dispatch({
            type: `${namespace}/saveIsLive`,
            payload: { isLive: value }
        })
    }

    function changeState(payload) {
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { ...payload }
        })
    }
    //编辑
    function editor(item, type) {
        let address = []
        let time = []
        time.push(moment(item.validityStartTime),moment(item.validityEndTime))
        quer.time1 = time
        quer.status = false
        quer.homeRecommendId = item.homeRecommendId
        address.push(item.provinceCode,item.cityCode)
        quer.address = address
        quer.recommendName = item.recommendName
        quer.validityEndTime = item.validityEndTime,
        quer.validityStartTime = item.validityStartTime,
        quer.productTag = item.productTag ? item.productTag : null
        quer.resourceType = type === 'build' ? 1 : type==='activity'? 2:3 
        dispatch({
            type: `${namespace}/updateStore`,
            payload: {quer}
        })
        updateModal({ name: type, flag: true })
    }
    function getTableColums(type) {
        let colums = [
            { title: '序号', dataIndex: 'key', key: 'key', },//0
            { title: '城市', dataIndex: 'provinceCityName', key: 'provinceCityName', },//0
            { title: '名称', dataIndex: 'recommendName', key: 'recommendName', },//1
            { title: '状态', dataIndex: 'status', key: 'time', 
                render:(text, item, index) =>{
                    return item.status == 1 ? '未生效' : item.status == 2 ? '已生效' : '已失效'
            }},//2
            { title: '生效时间', dataIndex: 'time', key: 'productName',
                render:(text, item, index) =>{
                    return `${item.validityStartTime} - ${item.validityEndTime}`
            }},//3
            { title: '更新人', dataIndex: 'updatePerson', key: 'updatePerson' },//4
            {
                title: '更新时间', dataIndex: 'updateTime', key: 'updateTime',//5
                // render: (text, item, index) => {
                //     return `${item.provinceName || ''}${item.provinceName && item.cityName && ' - ' || ''}${item.cityName || ''}`
                // }
            },
            {
                title: '操作', dataIndex: 'status', key: 'status',//length-1
                render: (text, item, index) => {
                    return <div>
                        <FlagBtn
                            node={<Link style={{marginRight:'10px'}} onClick={() => {
                                dispatch({
                                    type: `${namespace}/homeRecommendOfDelete`,
                                    payload: { item, type }
                                });
                            }}>当前城市置顶</Link>}
                            // btnId={'30402'}
                        >
                        </FlagBtn>
                        <FlagBtn
                            node={<Link onClick={() => {
                                editor(item, type)
                            }}>编辑</Link>}
                            // btnId={'30402'}
                        >
                        </FlagBtn>
                    </div>
                    // if (type == 'build') {
                    //     return <div>
                    //         <FlagBtn
                    //             node={<Link onClick={() => {
                    //                 dispatch({
                    //                     type: `${namespace}/homeRecommendOfDelete`,
                    //                     payload: { item, type }
                    //                 });
                    //             }}>当前城市置顶</Link>}
                    //             // btnId={'30402'}
                    //         >
                    //         </FlagBtn>
                    //     </div>
                    // } else if (type == 'activity') {
                    //     return <div>
                    //         <FlagBtn
                    //             node={<Link onClick={() => {
                    //                 dispatch({
                    //                     type: `${namespace}/homeRecommendOfDelete`,
                    //                     payload: { item, type }
                    //                 });
                    //             }}>删除</Link>}
                    //             // btnId={'30404'}
                    //         >
                    //         </FlagBtn>
                    //     </div>
                    // } else if (type == 'information') {
                    //     return <div>
                    //         <FlagBtn
                    //             node={<Link onClick={() => {
                    //                 dispatch({
                    //                     type: `${namespace}/homeRecommendOfDelete`,
                    //                     payload: { item, type }
                    //                 });
                    //             }}>删除</Link>}
                    //             // btnId={'30406'}
                    //         >
                    //         </FlagBtn>
                    //     </div>
                    // }
                },
            },
        ];
        return colums
        // let length = colums.length
        // if (type == "build") {
        //     return [colums[0], colums[3], colums[4], colums[length - 1]]
        // } else if ("activity" == type) {
        //     return [colums[1], colums[3], colums[5], colums[length - 1]]
        // } else if ("information" == type) {
        //     return [colums[2], colums[3], colums[length - 1]]
        // } else {
        //     colums.splice(0, 2)
        //     colums.splice(2, 1)
        //     return colums
        // }
    }
    function getModalColums(type) {
        let colums = [
            { title: '项目编码', dataIndex: 'productCode', key: 'productCode', },//0
            { title: '活动名称', dataIndex: 'activityName', key: 'activityName', },//1
            { title: '资讯名称', dataIndex: 'newsName', key: 'newsName' },//2
            { title: '楼盘名称', dataIndex: 'productName', key: 'productName' },//3
            {
                title: '省市', dataIndex: 'provinceName', key: 'provinceName',//4
                render: (text, item, index) => {
                    return `${item.provinceName || ''}${item.provinceName && item.cityName && ' - ' || ''}${item.cityName || ''}`
                }
            },
            { title: '创建时间', dataIndex: 'createTime', key: 'createTime' },//5
            {
                title: '操作', dataIndex: 'status', key: 'status',//6
                render: (text, item, index) => {
                    return <div>
                        {
                            item.sign ? <span>已添加</span>
                                : <Link onClick={() => {
                                    dispatch({
                                        type: `${namespace}/create`,
                                        payload: { item }
                                    });
                                }}>添加</Link>
                        }
                    </div>
                },
            },
        ];

        let length = colums.length
        if (type == "build") {
            return [colums[0], colums[3], colums[5], colums[length - 1]]
        } else if ("activity" == type) {
            return [colums[1], colums[3], colums[4], colums[5], colums[length - 1]]
        } else {
            return [colums[2], colums[3], colums[5], colums[length - 1]]
        }
        return colums
    }

    function 
    onSearchquer(val) {
        quer.searchName = val
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { quer }
        })
        dispatch({
            type: `${namespace}/target`,
            payload: {}
        })
    }

    function inputChangeBuild(e, name) {
        if(name === 'address'){
            quer.address = e
            quer.searchName = ''
            quer.provinceCode = e[0],
            quer.cityCode =  e[1]
        } else if(name === 'searchName') {
            quer.resourceId = e
            quer.recommendName = e
        } else if(name==='time') {
            quer.time1 = e
            console.log(e)
            quer.validityStartTime = e[0]._d
            quer.validityEndTime = e[1]._d
        } else if(name==='radio'){
            quer.productTag = e.target.value
        }
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { quer }
        })
        if(name === 'address'){
            dispatch({
                type: `${namespace}/target`,
                payload: {}
            })
        }
    }

    function queryList () {
        dispatch({
            type: `${namespace}/queryList`,
            payload: {}
        })
        dispatch({
            type: `${namespace}/queryActivityList`,
            payload: {}
        })
        dispatch({
            type: `${namespace}/queryNewsList`,
            payload: {}
        })
    }

    function queryChangeBuild(e, name) {
        if(name==='address'){
            quers.address = e
            queryData.provinceCode = e[0]
            queryData.cityCode = e[1]
        }else if(name==='status'){
            quers.zt = e
            queryData.status = e
        }else if(name==='time'){
            quers.time = e
            queryData.validityStartTime = e[0]._d
            queryData.validityEndTime = e[1]._d
        }else if(name==='name'){
            quers.name = e.target.value
            queryData.searchName = e.target.value
            console.log(e,queryData,1111)
        }
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { queryData,quer }
        })
    }

    function onSearch(type) {
        if (type == "build") {
            dispatch({
                type: `${namespace}/estateList`,
                payload: {}
            })
        } else if (type == "activity") {
            dispatch({
                type: `${namespace}/activityList`,
                payload: {}
            })
        } else {
            dispatch({
                type: `${namespace}/newsList`,
                payload: {}
            })
        }
    }
      function onReset (){
        quers={}
        queryData={}
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { quers }
        })
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { queryData }
        })
      };
    return (
        <div className={cx('pageLayout')}>
            {/*
          监控键盘事件，自动刷新数据
        */}
            {(buildData.modal_visible || activityData.modal_visible || informationData.modal_visible) &&
                <Keypress keyCode={13} cbk={() => {
                    onSearch(type);
                }} />
            }

            <Modal
                title={type == "build" ? "选择楼盘" : type == "activity" ? "选择活动" : "选择资讯"}
                width='80%'
                okText="确认"
				cancelText="取消"
                visible={type == "build" ? buildData.modal_visible : type == "activity" ? activityData.modal_visible : informationData.modal_visible}
                onCancel={() => { updateModal({ name: type, flag: false }) }}
                onOk={onhao}
                // footer={null}
            >
                <Row>
                    <FormItem {...formItemLayout} label={type == "build" ? "推荐楼盘" : type == "activity" ? "推荐活动" : "推荐资讯"} hasFeedback>
                        <Cascader options={options} disabled = {quer.status ? false : true} value={quer.address} onChange={e => inputChangeBuild(e, 'address')} placeholder="选择省市" />
                        <Select
                            showSearch
                            allowClear
                            placeholder="Select a person"
                            optionFilterProp="children"
                            value = {quer.recommendName}
                            disabled = {quer.address&&quer.status ? false : true}
                            onChange={e => inputChangeBuild(e, 'searchName')}
                            onSearch={onSearchquer}
                            filterOption={false}
                            placeholder={type == "build"?'请选择楼盘': type == "activity" ? "请选择活动" : "请选择资讯"}>
                                {type == "build"&&searchlist.map((item)=>{
                                        return <Option key={item.productId} value={item.productId}>{item.projectName}</Option>
                                })}
                                {type == "activity"&&searchlist.map((item)=>{
                                        return <Option key={item.productId} value={item.contentId}>{item.contentName}</Option>
                                })}
                                {type == "information"&&searchlist.map((item)=>{
                                        return <Option key={item.productId} value={item.contentId}>{item.contentName}</Option>
                                })}
                        </Select>
                       
                    </FormItem>
                    <FormItem {...formItemLayout} label='生效时间' hasFeedback>
                            <RangePicker style={{width:'100%'}} 
                                showTime={{ 
                                    hideDisabledOptions: true,
                                    defaultValue: [moment(null, 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],
                                }} value={quer.time1} onChange={e => inputChangeBuild(e, 'time')}/>
                    </FormItem>
                    {type == "build" &&
                        <FormItem {...formItemLayout} label='标签' hasFeedback>
                            <Radio.Group value={quer.productTag} onChange={e => inputChangeBuild(e, 'radio')}>
                                <Radio value={1}><img style={{width:'40px',height:'22px'}} src={'https://zmzj-pro.oss-cn-shenzhen.aliyuncs.com/label/new.png'} alt=""/></Radio>
                                <Radio value={2}><img style={{width:'40px',height:'22px'}} src={'https://zmzj-pro.oss-cn-shenzhen.aliyuncs.com/label/hot.png'} alt=""/></Radio>
                                <Radio value={3}><img style={{width:'40px',height:'22px'}} src={'https://zmzj-pro.oss-cn-shenzhen.aliyuncs.com/label/push.png'} alt=""/></Radio>
                            </Radio.Group>
                        </FormItem>
                    }
                    {/* {type == "activity" &&
                        <FormItem {...formItemLayout} label='活动名称' hasFeedback>
                            <Input placeholder="请输入项目编码"
                                value={activityData.conditionDetail.activityName}
                                onChange={e => inputChangeBuild(e.target.value, 'activityName')}
                            />
                        </FormItem>
                    }
                    {type == "information" &&
                        <FormItem {...formItemLayout} label='资讯名称' hasFeedback>
                            <Input placeholder="请输入资讯名称"
                                value={informationData.conditionDetail.newsName}
                                onChange={e => inputChangeBuild(e.target.value, 'newsName')}
                            />
                        </FormItem> */}
                    {/* } */}
                    {/* <Col span={8}>
                        <FormItem {...formItemLayout} label='楼盘名称' hasFeedback>
                            <Input placeholder="请输入楼盘名称"
                                value={type == "build" ? buildData.conditionDetail.productName : type == "activity" ? activityData.conditionDetail.productName : informationData.conditionDetail.productName}
                                onChange={e => inputChangeBuild(e.target.value, 'productName')}
                            />
                        </FormItem>
                    </Col>
                    <Col span={8}>
                        <Button onClick={() => { onSearch(type) }} loading={modelObj.loading}>搜索</Button>
                    </Col> */}
                </Row>
            </Modal>
                     {/* 是否显示直播信息开关 */}
                     <div className={cx('tableName')}>
                {/* <h3 style={{ fontWeight: 'bold' }}>显示直播信息开关</h3>
                 */}
                  <FormItem
                    {...formItemLayout1}
                    label="显示直播信息"
                >
                    {getFieldDecorator('isLive', {
                        initialValue: isLive,
                        valuePropName: 'checked',   // 为用getFieldDecorator()包装后的Switch组件设置属性
                    })
                        (<Switch onChange={(value, option) => { changeSwitch(value) }}
                            checkedChildren="是"
                            unCheckedChildren="否"
                        />)}
                </FormItem>
            </div>

            {/*楼盘 表格名称*/}
            <div  className={cx('tableName')}>
                <Col span={6}>
                    <FormItem {...queryItemLayout} label='选择城市' hasFeedback>
                        <Cascader options={options} value={quers.address} onChange={e => queryChangeBuild(e, 'address')} placeholder="请选择城市" />
                    </FormItem>
                </Col>
                <Col span={6}>
                    <FormItem {...queryItemLayout} label='状态' hasFeedback>
                        <Select     
                            allowClear
                            value={quers.zt}
                            placeholder="请选择状态"
                            onChange={e => queryChangeBuild(e, 'status')}>
                            <Option value= {1}>未生效</Option>
                            <Option value= {2}>已生效</Option>
                            <Option value={3}>已失效</Option>
                        </Select>
                    </FormItem>
                </Col>
                <Col span={6}>
                    <FormItem {...queryItemLayout} label='生效日期' hasFeedback>
                            <RangePicker style={{width:'100%'}} value={quers.time} onChange={e => queryChangeBuild(e, 'time')}/>
                    </FormItem>
                </Col>
                <Col span={6}>
                    <FormItem {...queryItemLayout} label='名称' hasFeedback>
                    <Input placeholder="请输入楼盘名称"
                        value={quers.name}
                        // value={activityData.conditionDetail.activityName}
                        onChange={e => queryChangeBuild(e, 'name')}
                    />
                    </FormItem>
                </Col>
            </div>
            <div style={{textAlign:'right',marginRight:'30px'}}>
                <Button type='primary' onClick={()=>{queryList()}}>搜索</Button>
                <Button  style={{marginLeft: '20px'}} onClick={onReset}>重置 </Button>
            </div>
            <div className={cx('tableName')}>
                <div>
                    <h3 style={{ fontWeight: 'bold' }}>推荐楼盘</h3>
                        <FlagBtn
                            node={<Button type="primary" htmlType="button" size="default" className={cx('addBtn')} 
                            onClick={
                                () => {
                                quer = { 
                                    status: true,
                                    resourceType: type === 'build' ? 1 : type==='activity'? 2:3
                                }
                                dispatch({
                                    type: `${namespace}/updateStore`,
                                    payload: { quer }
                                })
                                updateModal({ name: 'build', flag: true }) 
                            }}>新增</Button>}
                            btnId={'30401'}
                        >
                        </FlagBtn>
                    {/* <span className={cx('addtips')}>最多添加16个推荐楼盘</span> */}
                </div>
            </div>
            {/*楼盘 表格*/}
            <div className={cx('tableName', styles.table)}>
                <Table columns={getTableColums("build")}
                    dataSource={buildData.tableData.dataSource}
                    pagination={paginationBuild}
                />
            </div>
            <div className={cx('divide')}></div>
            {/*楼盘 新增弹窗*/}


            {/*活动 表格名称*/}
            <div className={cx('tableName')}>
                <h3 style={{ fontWeight: 'bold' }}>推荐活动</h3>
                <div>
                    <FlagBtn
                        node={<Button type="primary" htmlType="button" size="default" className={cx('addBtn')} onClick={
                            () => { 
                            quer = { status: true,
                                resourceType: type === 'build' ? 1 : type==='activity'? 2:3}
                            dispatch({
                                type: `${namespace}/updateStore`,
                                payload: { quer }
                            }) 
                            updateModal({ name: 'activity', flag: true })}
                        }>新增</Button>}
                        btnId={'30403'}
                    >
                    </FlagBtn>

                    {/* <span className={cx('addtips')}>最多添加16个推荐活动</span> */}
                </div>
            </div>
            {/*活动 表格*/}
            <div className={cx('tableName', styles.table)}>
                <Table columns={getTableColums("activity")}
                    dataSource={activityData.tableData.dataSource}
                    pagination={paginationActivity}
                />
            </div>
            <div className={cx('divide')}></div>


            {/*/!*资讯 表格名称*!/*/}
            <div className={cx('tableName')}>
                <h3 style={{ fontWeight: 'bold' }}>推荐资讯</h3>
                <div>
                    <FlagBtn
                        node={<Button type="primary" htmlType="button" size="default" className={cx('addBtn')} onClick={
                            () => { updateModal({ name: 'information', flag: true }) 
                            quer = { status: true,
                                resourceType: type === 'build' ? 1 : type==='activity'? 2:3}
                            dispatch({
                                type: `${namespace}/updateStore`,
                                payload: { quer }
                            })
                            updateModal({ name: 'information', flag: true }) }
                        }>新增</Button>}
                        btnId={'30405'}
                    >
                    </FlagBtn>

                    {/* <span className={cx('addtips')}>最多添加16个资讯</span> */}
                </div>
            </div>
            {/*资讯 表格*/}
            <div className={cx('tableName', styles.table)}>
                <Table columns={getTableColums("information")}
                    dataSource={informationData.tableData.dataSource}
                    pagination={paginationInformation}
                />
            </div>
            <div className={cx('divide')}></div>

        </div>
    )
}

// 连接视图(view)和模型(model)
export default connect(mapStateToProps)(Form.create()(indexSettingListView))
